<%--
  Created by IntelliJ IDEA.
  User: fengdefangxiang
  Date: 2022/2/9
  Time: 11:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>项目添加</title>
    <%@ include file="/web/header.jsp" %>
    <style>
        body {
            background: url('<%=app%>/web/base/img/one.png') no-repeat;
            background-size: cover;
        }
    </style>
</head>
<body class="body">
<fieldset class="layui-elem-field" style="margin: 10px">
    <legend>添加项目信息</legend>
    <div class="layui-field-box">
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <label class="layui-form-label">项目编号</label>
                <div class="layui-input-block">
                    <input type="text" name="code" required placeholder="请输入项目编号"
                           lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">项目名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required placeholder="请输入项目名称"
                           lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">开启时间</label>
                <div class="layui-input-block">
                    <input  type="text" id="startTime" name="startTime"  placeholder="请选择项目开启时间"
                            autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="button" value="确定" class="layui-btn layui-btn-radius" lay-submit lay-filter="add"> <!-- 确定按钮 -->
                    <input type="reset" value="重置" class="layui-btn layui-btn-radius layui-btn-warm">
                </div>
                <input type="button" value="关闭" class="layui-btn layui-btn-radius layui-btn-danger" onclick="layerClose()">
            </div>
            <input type="hidden" name="action" value="add">
        </form>
    </div>
</fieldset>

<script type="text/javascript">
    var laydate = layui.laydate;
    function renderDate(id){
        laydate.render({
            elem:"#"+id,
            type:"date",
            theme: '#56EBA0',
        })
    }
    renderDate("startTime")
    renderDate("endTime")

    formOnSubmit("add",'/ProjectServlet','text',function(data){
        if(data==1){
            layer.msg("添加成功",{shift: -1, time: 2000,icon: 6 },layerClose)
        }else if(data=="repeat"){
            layer.msg("编号存在,添加失败",{icon: 5})
        }else{
            layer.msg("添加失败",{icon: 5})
        }
    })



</script>

</body>
</html>
